package com.margo.project.redis.service;


import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

@Service
public class RedisValueOperationsServiceImpl {
	@Autowired
	protected RedisTemplate<String, Object> redisTemplate;
	@Resource
	protected ValueOperations<Object, Object> valueOperations;
	
	/**
     * 添加
     *
     * @param key    key
     * @param doamin 对象
     * @param expire 过期时间(单位:秒),传入 -1 时表示不设置过期时间
     */
    public void put(Object key, Object value, long expire) {
    	valueOperations.set(key, value);
    }

	public Object get(Object key) {
		return valueOperations.get(key);
	}
}
